<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

ini_set('max_execution_time', 3600);
ini_set('memory_limit', '128M');
include_once(dirname(dirname(dirname(dirname(__FILE__)))) . '/engine/start.php');
include_once(dirname(dirname(__FILE__)) . '/_init.php');

$query = "SELECT guid FROM 3lGG_entities WHERE subtype = 15 AND owner_guid > 0";

$results = safe_select_query($query);
$count = 0;
foreach($results as $result) {
    $tw = get_entity($result->guid);
    if($tw) {
        $owner = get_user($tw->owner_guid);
        if($owner) {
            $id = add_twitter_account($owner->guid, $tw->alias, $tw->id, $owner->name, '');
            if($id) {
                $count++;
            }   
        }
    }
}

echo $count;

?>
